package com.newhopegroup.webcommons.restful.api.result;

import java.io.Serializable;

/**
 * Created by wangshida on 15/10/28.
 */
public class Result implements Serializable {
    private Object data;
    private Status status;

    public Result() {
    }

    public Result(Object data, Status status) {
        this.data = data;
        this.status = status;
    }

    public static Result buildDone() {
        return new Result(null, Status.buildDone());
    }

    public static Result buildFailed() {
        return new Result(null, Status.buildFailed());
    }

    public static Result build(Object data, Status status) {
        return new Result(data, status);
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "Result{" +
                "data=" + data +
                ", status=" + status +
                '}';
    }
}
